package com.kingsoft.dc.khaos.extender.meta.impl;

import com.alibaba.fastjson.JSON;
import com.kingsoft.dc.khaos.extender.meta.model.ds.Connect;
import com.kingsoft.dc.khaos.extender.meta.model.ds.PhoenixConnect;

import java.util.Map;

/**
 * @Author: Chris J
 * @Date: 2020-09-03.
 */
public class PhoenixDmMetaImpl extends DmMetaImpl {
    @Override
    public Connect decryptDatasourceConnectSecret(String config) {
        PhoenixConnect connect = JSON.parseObject(config, PhoenixConnect.class);
        Map<String, String> map = (Map<String, String>) JSON.parse(config);
        String zookeeper_znode_parent = map.get("zookeeper.znode.parent");
        String phoenix_schema_isNamespaceMappingEnabled = map.get("phoenix.schema.isNamespaceMappingEnabled");
        connect.setZookeeper_znode_parent(zookeeper_znode_parent);
        connect.setPhoenix_schema_isNamespaceMappingEnabled(phoenix_schema_isNamespaceMappingEnabled);
        return connect;
    }
}
